//
//  ButtonStyle.swift
//  ptbuy
//
//  Created by MyMac on 2024/11/15.
//
import SwiftUI
struct MyButtonStyle: ButtonStyle {

     var width:CGFloat
     var size:CGFloat
     var height:CGFloat
    
    func makeBody(configuration: Configuration) -> some View {
        configuration.label
            .padding(5)
            .frame(width: width,height: height)
                .font(.system(size: size)).overlay(
                RoundedRectangle(cornerRadius: 10)
                    .stroke(Color.black, lineWidth: 1) // 设置边框
            )
            .background(
                LinearGradient(
                    gradient: Gradient(
                        colors: [
                            Color("startColor").opacity(5),
                            Color("endColor").opacity(0.5)
                        ]
                    ),
                    startPoint: .top,
                    endPoint: .bottom
                )
                .edgesIgnoringSafeArea(
                    .all
                ) // 忽略安全区域，使视图覆盖整个屏幕
                    .frame(
                        maxWidth: .infinity,
                        maxHeight: .infinity
                    ) .cornerRadius(10) // 设置最大宽高为无穷，确保视图覆盖全屏
            )
    }
}
